#include <iostream>
#include <string>
using namespace std;
int main() {
    string a = "hello world";
    string b = "hello C++";
    cout<<"字符串的长度为: "<<a.length()<<endl;
    cout<<"字符串为: "<<a<<"\n";
    cout<<"字符串的地址为: "<<&a<<"\n";
    cout<<"字符串的字节数： "<<a.size()<<"\n";
    //从位置2开始查找第一个为l的字符下标
    cout<<"从位置2开始查找第一个l出现的下标"<<a.find('l',2)<<'\n';
    cout<<"反向查找l出现的位置，查找起点在最后一位:"<<a.rfind('d',0)<<"\n";
    cout<<"字符串的最大长度为:"<<a.max_size()<<"\n";
    cout<<"字符串相加:"<<a+b<<"\n";
    cout<<b.substr(2,6);
    return 0;
}